<?php

class BackendArticlePictureForm extends ArticlePictureForm
{
  public function configure()
  {
    unset($this['created_at'], $this['updated_at']);
    $this->widgetSchema['article_id'] = new sfWidgetFormInputText();
    
    $this->widgetSchema['picture'] = new sfWidgetFormInputFileEditable(array(
      'is_image' => true,
      'edit_mode' => !$this->isNew(),
      'file_src' => sprintf(sfConfig::get('app_path_article_picture'), $this->getObject()->getPicture()),
      'with_delete' => false
    ));
    
    $this->validatorSchema['picture'] = new sfValidatorFile(array(
      'max_size' => 3 * 1024 * 1024,
      'path' => Wills::getUploadDirByWebPath(sfConfig::get('app_path_article_picture')),
      'mime_types' => 'web_images',
      'required' => $this->isNew()
    ));
    
    $this->validatorSchema['picture']->setOption('required', false);
  }
}